﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ServerPanel : MonoBehaviour
{
    public Text text;
    void Start()
    {
        
    }

    bool isLoad = false;
    void Update()
    {
        text.text = "已链接得客户端数量：" + Server.Instance.clients.Count;
        if (Server.Instance.clients.Count > 1 && !isLoad)
        {
            isLoad = true;
            GameController.LoadScene(SceneEnum.Game);
            for (int i = 0; i < Server.Instance.clients.Count; i++)
            {
                Info info = new Info();
                info.infoType = 1;
                info.operation = new Operation();
                info.operation.index = i + 1;
                Server.Instance.clients[i].ClientSend(LitJson.JsonMapper.ToJson(info));
            }
            
        }
    }
}
